package homework7;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Main {
    public static void main(String[] args) {
        // 创建学生对象
        Student student1 = new Student(1, "张三", 90);
        Student student2 = new Student(2, "李四", 85);
        Student student3 = new Student(3, "王五", 95);

        // 创建班级Map并添加学生
        Map<Integer, Student> class1 = new HashMap<>();
        class1.put(student1.getId(), student1);
        class1.put(student2.getId(), student2);

        Map<Integer, Student> class2 = new HashMap<>();
        class2.put(student3.getId(), student3);

        // 创建年级List并添加班级
        List<Map<Integer, Student>> grade = new ArrayList<>();
        grade.add(class1);
        grade.add(class2);

        // 遍历输出年级学生信息
        for (Map<Integer, Student> classMap : grade) {
            for (Student student : classMap.values()) {
                System.out.println("学号：" + student.getId() + "，姓名：" + student.getName() + "，成绩：" + student.getScore());
            }
        }
    }
}